package com.sgb.kjwl.model.entity.transport;

import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;

import com.contrarywind.interfaces.IPickerViewData;
import com.google.gson.annotations.SerializedName;

import java.io.Serializable;
import java.util.List;

public class GoodsInfoTypeEntity3 implements IPickerViewData, Serializable, Parcelable {

    @SerializedName(value = "no", alternate = {"id"})
    private String no;
    @SerializedName(value = "name", alternate = {"distance"})
    private String name;
    //车型图用
    private String typeImg;

    private String parentNo;

    //后台配置 物流首页金刚区显示图
    private String kingKongDiagram;
    //获取车型关联车长接口时使用
    private List<GoodsInfoTypeEntity3> carLenList;
    //货物类型二级分类列表
    private List<GoodsInfoTypeEntity3> childList;

    public GoodsInfoTypeEntity3() {
    }

    public GoodsInfoTypeEntity3(String no, String name) {
        this.no = no;
        this.name = name;
    }

    protected GoodsInfoTypeEntity3(Parcel in) {
        no = in.readString();
        name = in.readString();
        typeImg = in.readString();
        kingKongDiagram = in.readString();
        carLenList = in.createTypedArrayList(GoodsInfoTypeEntity3.CREATOR);
        childList = in.createTypedArrayList(GoodsInfoTypeEntity3.CREATOR);
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(no);
        dest.writeString(name);
        dest.writeString(typeImg);
        dest.writeString(kingKongDiagram);
        dest.writeTypedList(carLenList);
        dest.writeTypedList(childList);
    }

    @Override
    public int describeContents() {
        return 0;
    }

    public static final Creator<GoodsInfoTypeEntity3> CREATOR = new Creator<GoodsInfoTypeEntity3>() {
        @Override
        public GoodsInfoTypeEntity3 createFromParcel(Parcel in) {
            return new GoodsInfoTypeEntity3(in);
        }

        @Override
        public GoodsInfoTypeEntity3[] newArray(int size) {
            return new GoodsInfoTypeEntity3[size];
        }
    };

    public String getNo() {
        return no;
    }

    public void setNo(String no) {
        this.no = no;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getTypeImg() {
        return typeImg;
    }

    public void setTypeImg(String typeImg) {
        this.typeImg = typeImg;
    }

    public List<GoodsInfoTypeEntity3> getCarLenList() {
        return carLenList;
    }

    public void setCarLenList(List<GoodsInfoTypeEntity3> carLenList) {
        this.carLenList = carLenList;
    }

    public String getKingKongDiagram() {
        return kingKongDiagram;
    }

    public void setKingKongDiagram(String kingKongDiagram) {
        this.kingKongDiagram = kingKongDiagram;
    }

    public List<GoodsInfoTypeEntity3> getChildList() {
        return childList;
    }

    public void setChildList(List<GoodsInfoTypeEntity3> childList) {
        this.childList = childList;
    }

    public String getParentNo() {
        return parentNo;
    }

    public void setParentNo(String parentNo) {
        this.parentNo = parentNo;
    }

    @Override
    public String getPickerViewText() {
        return name;
    }


    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) return false;

        if (obj instanceof GoodsInfoTypeEntity3) {
            return no.equals(((GoodsInfoTypeEntity3) obj).getNo());
        }
        return false;

    }

    @Override
    public int hashCode() {
        return TextUtils.isEmpty(no) ? "".hashCode() : no.hashCode();
    }
}
